CREATE TABLE [dbo].[wap_ingreso_sistema]
(
[fe_ingreso] [dbo].[_fechahora] NOT NULL,
[cd_operador] [dbo].[_nombre] NOT NULL,
[nm_terminal] [dbo].[_nombre] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wap_ingreso_sistema] ADD CONSTRAINT [PK_wap_ingreso_sistema] PRIMARY KEY NONCLUSTERED  ([fe_ingreso], [cd_operador], [nm_terminal]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [FK_cd_operador] ON [dbo].[wap_ingreso_sistema] ([cd_operador]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [FK_nm_terminal] ON [dbo].[wap_ingreso_sistema] ([nm_terminal]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wap_ingreso_sistema] ADD CONSTRAINT [FK_wap_ingreso_sistema_wad_operadores] FOREIGN KEY ([cd_operador]) REFERENCES [dbo].[wad_operadores] ([cd_operador]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[wap_ingreso_sistema] ADD CONSTRAINT [FK_wap_ingreso_sistema_wad_terminales] FOREIGN KEY ([nm_terminal]) REFERENCES [dbo].[wad_terminales] ([nm_terminal]) ON DELETE CASCADE
GO
EXEC sp_bindefault N'[dbo].[date]', N'[dbo].[wap_ingreso_sistema].[fe_ingreso]'
GO
